package com.pinyoumei.app.adapter;

import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.widget.TextView;

import com.pinyoumei.app.R;
import com.pinyoumei.app.bean.MyBillBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2021-08-09.
 * --------- 日期 ------- 维护人 ------------ 变更内容 --------
 * 2021-08-09        Administrator             新增Person类
 * 2021-08-09        Administrator             增加sex属性
 */
public class MybillAdapter extends BaseQuickAdapter<MyBillBean.ResultBean.DataListBean, BaseViewHolder> {
    public MybillAdapter(int layoutResId, @Nullable List<MyBillBean.ResultBean.DataListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MyBillBean.ResultBean.DataListBean item) {

        helper.setText(R.id.tv_add_time,item.getAdd_time());

        helper.setText(R.id.tv_reason,item.getReason());

        helper.setText(R.id.tv_amount,"余额："+item.getBalance());

       TextView tv_tv_amount_type =  helper.getView(R.id.tv_tv_amount_type);

       switch (item.getDeal_type()) {
       	case 1:
            tv_tv_amount_type.setText("+" + item.getAmount());
            tv_tv_amount_type.setTextColor(ContextCompat.getColor(mContext,R.color.green_bg2));
       		break;
       	case 2:
            tv_tv_amount_type.setText("-" + item.getAmount());
            tv_tv_amount_type.setTextColor(ContextCompat.getColor(mContext,R.color.text_red2));
       		break;

       	default:
       		break;
       }
    }
}
